/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rafkind.resrev.dao;

import com.rafkind.resrev.data.Reservation;
import com.rafkind.resrev.data.Resource;
import com.rafkind.resrev.data.User;
import java.util.Date;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Fictional Hero
 */
public interface ReservationDao {
  @Transactional
  void saveReservation(Reservation r);
  
  List<Reservation> findPossibleConflicts(
      Reservation existingReservation,
      Resource resource, 
      Date start, 
      Date end);
  
  List<Reservation> findReservations(Date start, 
      Date end);
  
  Reservation getReservation(int id);
  
  List<Reservation> getApprovableReservations(
      User user, int first, int count, 
              String sortProperty, boolean isAscending);
  
  int countApprovableReservations(User user);
  
  List<Reservation> getPendingReservations(
      User user, int first, int count, 
              String sortProperty, boolean isAscending);
  
  int countPendingReservations(User user);
  
  List<Reservation> getAllReservations(
      User user, int first, int count, 
              String sortProperty, boolean isAscending);
  
  int countAllReservations(User user);
 
  @Transactional
  void deleteReservation(Reservation reservation);
 
  
}
